using System;
using System.Web;
using Moxiecode.TinyMCE.Compression;

namespace Moxiecode.TinyMCE.Web.HttpPipeline 
{
	public class HttpHandler : System.Web.IHttpHandler 
    {
		public HttpHandler() { }

		public bool IsReusable 
        {
			get { return true; }
		}

		public void ProcessRequest(HttpContext context) 
        {
			HttpRequest request = context.Request;
			HttpResponse response = context.Response;
			IModule module = null;

			// This might include some form of dynamic class loading later
			switch (request.QueryString["module"]) {
				case "GzipModule":
					module = new Moxiecode.TinyMCE.Compression.GzipModule();
					break;

				case "SpellChecker":
					module = new Moxiecode.TinyMCE.SpellChecker.SpellCheckerModule();
					break;
			}

			if (module != null)
				module.ProcessRequest(context);
		}
	}
}
